cmake_minimum_required(VERSION 3.12)

project(lua)

set(CMAKE_EXPORT_COMPILE_COMMANDS 1)

aux_source_directory(core core_src)

aux_source_directory(lib lib_src)

set(base_src ${core_src} ${lib_src})

add_definitions(-DDLUA_USE_LINUX)

include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/core
    ${CMAKE_CURRENT_SOURCE_DIR}/lib
)

add_library(lua_a STATIC ${base_src})

set_target_properties(lua_a PROPERTIES OUTPUT_NAME lua)

add_executable(lua lua.c)

target_link_libraries(lua lua_a dl m)


add_executable(luac luac.c)

target_link_libraries(luac lua_a dl m)
